<%
String peopleId = request.getParameter("peopleId");
%>
<html>
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
     <style type="text/css">
            @import "dojo/dojo-release-1.0.0/dijit/themes/tundra/tundra.css";
            @import "dojo/dojo-release-1.0.0/dojo/resources/dojo.css";
            @import "dojo/dojo-release-1.0.0/dojox/grid/_grid/tundraGrid.css";
            @import "dojo/dojo-release-1.0.0/dojox/grid/_grid/Grid.css";
            @import "js/dijitTests.css";
            @import "js/wlProject.css";
	
      </style>
      <script type="text/javascript" src="dojo/dojo-release-1.0.0/dojo/dojo.js"  djConfig="parseOnLoad: true, isDebug: true,locale: 'zh-cn', extraLocale: ['zh-TW', 'fr']"></script>
      <script type="text/javascript" >
            dojo.require("dojo.parser");
            dojo.require("dijit.form.Button");
            dojo.require("dijit.Menu");
			      dojo.require("dijit.Tooltip");
            
    </script>
     <script type="text/javascript" src="js/soapclient.js"></script>
     <script type="text/javascript" src="js/wlProject.js"></script>
     <script type="text/javascript" src="js/handle.js"></script>
    <script type="text/javascript">
	var url=getUrl()+ "services/RoleHandleManageService";
	//var querydata = new Array();
	function getHandle(peoId,pSno){
	    var handledata = new Array();
	    var pu = new SOAPClientParameters();
      pu.add('peopleId',peoId) ;
      pu.add('parentSno',pSno) ;
	    SOAPClient.invoke(url,"getHandleByPeopleAndParentSno", pu, false,  function GetEnu_callBack(ul, soapResponse){      
           handledata=HandleInfoVOtoArray_fun(ul,false);
      });
      return handledata; 
   } 
  function makeHandle(peoId,pSno){
      var querydata=getHandle(peoId,pSno);
      var menu = new dijit.Menu({ });
  		menu.domNode.style.display="none";
  	for(var i=0;i<querydata.length;i++){	
    	if(querydata[i][6]==1){
    	  var pSubMenu = new dijit.Menu({parentMenu:menu, id:"progSubMenu"+i});
    	  pSubMenu.addChild(new dijit.MenuItem({label:"ssd"}));
    		var menuItem = new dijit.PopupMenuItem({
    			label: querydata[i][3],
    			popup:pSubMenu
    			//iconClass:"dijitEditorIcon dijitEditorIconSave",
    			//onClick: function(){alert("jhj");makeHandle(peoId,querydata[i][2]);}
    		});
    		menu.addChild(menuItem);  
    	}else{
    		var menuItem = new dijit.MenuItem({
    			label: querydata[i][3],
    			//iconClass:"dijitEditorIcon dijitEditorIconSave",
    		});
    		menu.addChild(menuItem);    
      }
    }
    menu.startup();
    return   menu;
  } 
  function clickfin(a){
  alert("jhj"+a);
  }
  
	dojo.addOnLoad(function(){
	  var querydata=getHandle("<%=peopleId%>",'');
	  for(var i=0;i<querydata.length;i++){
	     document.getElementById("mainMenu").innerHTML=document.getElementById("mainMenu").innerHTML+"<div id='mainMenu"+i+"'></div>";
	  }
	  for(var i=0;i<querydata.length;i++){
	      var menu=makeHandle("<%=peopleId%>",querydata[i][2]);
	      
        var params = {
          showLabel:"false",
    			label: querydata[i][3],
    			name: querydata[i][1],
    			dropDown: menu,
    			//onclick: function(){alert("jhj");if(this.getChild().length=0)makeHandle("<%=peopleId%>",querydata[i][2]);}
    			//onClick:clickfin
    			//dropDown: menu
    		};
    		var widget = new dijit.form.DropDownButton(params, document.getElementById("mainMenu"+i));
		}
	});
	</script>
</head>
<body class="tundra">
<div id="mainMenu"><div>
	<!--div id="" dojoType="dijit.form.DropDownButton" iconClass="noteIcon">
			<span id="" >Edit<b>!</b></span>
			<div dojoType="dijit.Menu">
				<div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconCut"
					onClick='cutt(this);'>Cut</div>
				<div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconCopy"
					onClick="console.log('not actually copying anything, just a test!')">Copy</div>
				<div dojoType="dijit.MenuItem"  iconClass="dijitEditorIcon dijitEditorIconPaste"
					onClick="console.log('not actually pasting anything, just a test!')">Paste</div>
				<div dojoType="dijit.MenuSeparator"></div>
				<div dojoType="dijit.PopupMenuItem">
					<span>Submenu</span>
					<div dojoType="dijit.Menu" id="submenu2">
						<div dojoType="dijit.MenuItem" onClick="console.log('Submenu 1!')">Submenu Item One</div>
						<div dojoType="dijit.MenuItem" onClick="console.log('Submenu 2!')">Submenu Item Two</div>
						<div dojoType="dijit.PopupMenuItem">
							<span>Deeper Submenu</span>
							<div dojoType="dijit.Menu" id="submenu4"">
								<div dojoType="dijit.MenuItem" onClick="console.log('Sub-submenu 1!')">Sub-sub-menu Item One</div>
								<div dojoType="dijit.MenuItem" onClick="console.log('Sub-submenu 2!')">Sub-sub-menu Item Two</div>
							</div>
						</div>
					</div>
				</div>
			</div-->
			
</body></html>
